﻿function ClientAddFolderType() {
    Url = Portal.OfficeMan.FolderType.GetAddUrl().value;
    window.open(Url, '_self'); 
    //ClientReading();
}

function ClientSaveAddFolderType() {
    FolderTypeCode = document.getElementById("txtFolderTypeCode").value;
    FolderTypeName = document.getElementById("txtFolderTypeName").value;
    TypeIndex=document.getElementById("drpSelectType").selectedIndex;
    Type=document.getElementById("drpSelectType").options[TypeIndex].value;
    RetValue = Portal.OfficeMan.AddFolderType.ServerSideAddFolderType(FolderTypeCode, FolderTypeName,Type).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    document.getElementById("txtFolderTypeCode").value = "";
    document.getElementById("txtFolderTypeName").value = "";
    document.getElementById("txtFolderTypeName").focus();
    //window.close();
}

function ClientUpdateFolderType(FolderTypeId) {
    Url = Portal.OfficeMan.FolderType.GetUpdateUrl(FolderTypeId).value;
    window.open(Url, '_self');
    //ClientReading();
}

function ClientDeleteFolderType(FolderTypeId)
{
    Msg=Portal.OfficeMan.FolderType.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = Portal.OfficeMan.FolderType.ServerSideDeleteFolderType(FolderTypeId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    ClientReading();
}



function ShowClientUpdateUrlForm(FolderTypeCode)
{
    Url = Portal.OfficeMan.FolderType.GetUpdateUrl(FolderTypeCode).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_self'); 
}


function ClientSaveUpdateFolderType(FolderTypeId)
{
    FolderTypeCode = document.getElementById("txtFolderTypeCode").value;
    FolderTypeName = document.getElementById("txtFolderTypeName").value;

    RetValue = Portal.OfficeMan.UpdateFolderType.ServerSideUpdateFolderType(FolderTypeId,FolderTypeCode, FolderTypeName).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    window.open('default.aspx?WebPartId=FolderType','_self');
}

function ClientReading() {
   document.getElementById("divProcessing").innerHTML = Portal.OfficeMan.FolderType.GetProcessingText().value;
   setTimeout("RealClientReading()",10);
}

function RealClientReading() {
    rValue = Portal.OfficeMan.FolderType.GetFolderType().value;
    document.getElementById("divFolderTypeContent").innerHTML = rValue;
    document.getElementById("divProcessing").innerHTML = "";
}
